#pragma once
#include "Event.h"

namespace Orange
{
    class KeyEvent : public Event
    {
    public:
        inline int GetCode() { return m_KeyCode; };

#ifdef ORANGE_VS
        EVENT_CLASS_CATEGORY(EventCategoryKeyboard | EventCategoryInput);
#else
        virtual int GetEventCategory() const override
        {
            return EventCategoryKeyboard | EventCategoryInput;
        };
#endif
    protected:
        KeyEvent(int code) : m_KeyCode(code) {}
        int m_KeyCode;
    };

    class KeyPressedEvent : public KeyEvent
    {
    public:
        KeyPressedEvent(int code, int repeat) : KeyEvent(code), m_repeaat(m_repeaat)
        {
        }

        std::string ToString() const override
        {
            std::stringstream ss;
            ss << "KeyPressedEvent:"
               << "code" << m_KeyCode << ",repeat" << m_repeaat;
            return ss.str();
        }

#ifdef ORANGE_VS
        EVENT_CLASS_TYPE(KeyPressed);
#else
        static EventType GetStaticEventType()
        {
            return EventType::KeyPressed;
        };
        virtual EventType GetEventType() const override { return GetStaticEventType(); };
        virtual const char *GetName() const override { return "KeyPressed"; };
#endif

    private:
        int m_repeaat;
    };

    class KeyReleasedEvent : public KeyEvent
    {
    public:
        KeyReleasedEvent(int code) : KeyEvent(code) {}
        std::string ToString() const override
        {
            std::stringstream ss;
            ss << "KeyReleased:"
               << "code" << m_KeyCode;
            return ss.str();
        }

#ifdef ORANGE_VS
        EVENT_CLASS_TYPE(KeyReleased);
#else
        static EventType GetStaticEventType()
        {
            return EventType::KeyReleased;
        };
        virtual EventType GetEventType() const override { return GetStaticEventType(); };
        virtual const char *GetName() const override { return "KeyReleased"; };
#endif
    };

    class KeyTypedEvent : public KeyEvent
    {
    public:
        KeyTypedEvent(int code) : KeyEvent(code) {}
        std::string ToString() const override
        {
            std::stringstream ss;
            ss << "KeyTypedEvent:"
               << "code" << m_KeyCode;
            return ss.str();
        }

#ifdef ORANGE_VS
        EVENT_CLASS_TYPE(KeyTyped);
#else
        static EventType GetStaticEventType()
        {
            return EventType::KeyTyped;
        };
        virtual EventType GetEventType() const override { return GetStaticEventType(); };
        virtual const char *GetName() const override { return "KeyTyped"; };
#endif
    };

}